/**
  ******************************************************************************
  * @file    typedefine.h
  * @author  software Team
  * @brief   This file provides all the types.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2020 Hyseim. Co., Ltd.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */

#ifndef __TYPE_DEFINE_H__
#define __TYPE_DEFINE_H__
#include <stdint.h>
#include <stdbool.h>

#define FALSE                   0
#define TRUE                    1

typedef signed char             s8;
typedef unsigned char           u8;
typedef signed short            s16;
typedef unsigned short          u16;
typedef signed long             s32;
typedef unsigned long           u32;
typedef signed long long        s64;
typedef unsigned long long      u64;
#if 0
typedef signed char             int8_t;
typedef unsigned char           uint8_t;
typedef short                   int16_t;
typedef unsigned short          uint16_t;
typedef long                    int32_t;
typedef unsigned long           uint32_t;
typedef unsigned long long      uint64_t;
typedef unsigned char           bool;
#endif

typedef float                   float32_t;
typedef double                  float64_t;

typedef union{
    unsigned char       byte;
    struct{
        unsigned char   b7:1;
        unsigned char   b6:1;
        unsigned char   b5:1;
        unsigned char   b4:1;
        unsigned char   b3:1;
        unsigned char   b2:1;
        unsigned char   b1:1;
        unsigned char   b0:1;
    }                   bit;
}                       abyte;


typedef union{
    unsigned short      word;
    struct{
        unsigned char   h;
        unsigned char   l;
    }                   byte;
    struct{
        unsigned char   b15:1;
        unsigned char   b14:1;
        unsigned char   b13:1;
        unsigned char   b12:1;
        unsigned char   b11:1;
        unsigned char   b10:1;
        unsigned char   b9:1;
        unsigned char   b8:1;
        unsigned char   b7:1;
        unsigned char   b6:1;
        unsigned char   b5:1;
        unsigned char   b4:1;
        unsigned char   b3:1;
        unsigned char   b2:1;
        unsigned char   b1:1;
        unsigned char   b0:1;
    }                   bit;
}                       aword;

typedef union{
    unsigned long       dword;
    struct{
        unsigned short  h;
        unsigned short  l;
    }                   word;
    struct{
        unsigned char   hh;
        unsigned char   hl;
        unsigned char   lh;
        unsigned char   ll;
    }                   byte;
    struct{
        unsigned char   b31:1;
        unsigned char   b30:1;
        unsigned char   b29:1;
        unsigned char   b28:1;
        unsigned char   b27:1;
        unsigned char   b26:1;
        unsigned char   b25:1;
        unsigned char   b24:1;
        unsigned char   b23:1;
        unsigned char   b22:1;
        unsigned char   b21:1;
        unsigned char   b20:1;
        unsigned char   b19:1;
        unsigned char   b18:1;
        unsigned char   b17:1;
        unsigned char   b16:1;
        unsigned char   b15:1;
        unsigned char   b14:1;
        unsigned char   b13:1;
        unsigned char   b12:1;
        unsigned char   b11:1;
        unsigned char   b10:1;
        unsigned char   b9:1;
        unsigned char   b8:1;
        unsigned char   b7:1;
        unsigned char   b6:1;
        unsigned char   b5:1;
        unsigned char   b4:1;
        unsigned char   b3:1;
        unsigned char   b2:1;
        unsigned char   b1:1;
        unsigned char   b0:1;
    }                   bit;
}                       along;


#endif
